#!/bin/bash
function dir_exists_or_die() {
    local d="$1"
    if [ ! -d "${d}" ]
    then
        echo "Directory ${d} not found!"
        exit -1
    fi
}

function absPath() {
    local p="$1"
    if [ ${p:0:1} = "/" ]
    then
        echo ${p}
        return
    elif [ ${p:0:1} = "." ]
    then
        if [ ${#p} -ge 2 ] && [ ${p:1:1} = "/" ]
        then
            echo "$( pwd )/${p:2}"
        else
            echo "$( pwd )"
        fi
    else
        echo "$( pwd )/${p}"
    fi
}
